abstract class Animal {
    // 基本属性
    protected String name;
    protected String type;
    protected String breed;
    protected double price;



//     构造方法
    public Animal(String name, String type, String breed, double price) {
        this.name = name;
        this.type = type;
        this.breed = breed;
        this.price = price;
    }

    // 基本方法
    public abstract void eat();
    public abstract void sleep();
    public abstract void play();
    public void bark() {
        System.out.println(name + " says: " + (type.equals("猫") ? "Meow" : "Woof"));
    }
}

// 小猫子类
class Cat extends Animal {
    public Cat(String name, String breed, double price) {
        super(name, "猫", breed, price);
    }

    @Override
    public void eat() {
        System.out.println(name + " is eating.");
    }

    @Override
    public void sleep() {
        System.out.println(name + " is sleeping.");
    }

    @Override
    public void play() {
        System.out.println(name + " is playing.");
        // 猫只有在玩的时候才会叫
        bark();
    }
}

// 小狗子类
class Dog extends Animal {
    public Dog(String name, String breed, double price) {
        super(name, "狗", breed, price);
    }

    @Override
    public void eat() {
        System.out.println(name + " is eating.");
    }

    @Override
    public void sleep() {
        System.out.println(name + " is sleeping.");
    }

    @Override
    public void play() {
        System.out.println(name + " is playing.");
    }
}

public class Main1 {
    public static void main(String[] args) {
        Cat cat1 = new Cat("Tom", "Siamese", 1500);
        Cat cat2 = new Cat("Jerry", "Persian", 1200);

        // 实例化两个小狗对象
        Dog dog1 = new Dog("Buddy", "Golden Retriever", 2000);
        Dog dog2 = new Dog("Charlie", "Bulldog", 1800);

        // 演示小猫和小狗的行为
        cat1.eat();
        cat1.sleep();
        cat1.play();

        dog1.eat();
        dog1.sleep();
        dog1.play();
    }
}
